Skip to content

test: use random host port for dind TLS build test#13630

Merged
glours merged 1 commit intodocker:mainfrom
ricardobranco777:fix_testbuildtls
Mar 31, 2026
Merged

test: use random host port for dind TLS build test#13630
glours merged 1 commit intodocker:mainfrom
ricardobranco777:fix_testbuildtls

Conversation

@ricardobranco777
Copy link
Copy Markdown
Contributor

@ricardobranco777 ricardobranco777 commented Mar 10, 2026

What I did

Use random host port to fix TestBuildTLS on TLS-enabled hosts.

Otherwise test fails with:
docker: Error response from daemon: failed to set up container networking: driver failed programming external connectivity on endpoint e2e-dind-builder (b6c6ef56255e36311caf121fdc29e0ad85f608a89aacafd152dd489a71fb0863): Bind for 0.0.0.0:2376 failed: port is already allocated
Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did

Copy link
Copy Markdown
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just rename the last command result as res instead of res2

Signed-off-by: Ricardo Branco <rbranco@suse.de>
Copilot AI review requested due to automatic review settings March 31, 2026 15:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the TestBuildTLS e2e test to avoid host port collisions on TLS-enabled Docker hosts by switching the Docker-in-Docker (dind) container to use an ephemeral (random) mapped host port and then discovering that port via docker inspect before creating the Docker context.

Changes:

  • Map dind’s container port 2376/tcp to a random host port on 127.0.0.1 instead of hard-coding 2376:2376.
  • Query the selected host port from docker inspect and use it when creating the Docker context for the test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glours glours enabled auto-merge (rebase) March 31, 2026 17:07
@glours glours merged commit 73d8a6d into docker:main Mar 31, 2026
42 of 43 checks passed
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ricardobranco777 ricardobranco777 deleted the fix_testbuildtls branch March 31, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants